<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%-- <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> --%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>众诚考勤系统用户登录</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/jquery-1.9.0.min.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/login.js"></script>
<link href="${pageContext.request.contextPath}/css/login.css"
	rel="stylesheet" type="text/css" />
</head>
<body>
	<h1>众诚考勤系统登录</h1>
	<div class="login" style="margin-top: 50px;">
		<div class="web_qr_login" id="web_qr_login"
			style="display: block; height: 235px;">

			<!--登录-->
			<div class="web_login" id="web_login">

				<div class="login-box">


					<div class="login_form">
						<form name="loginform" accept-charset="utf-8" id="login_form"
							class="loginForm" method="post">
							<input type="hidden" name="did" value="0" /> <input
								type="hidden" name="to" value="log" />
							<div class="uinArea" id="uinArea">
								<label class="input-tips" for="u">工号：</label>
								<div class="inputOuter" id="uArea">
									<input type="text" id="u" name="mobile" class="inputstyle" />
								</div>
							</div>
							<div class="pwdArea" id="pwdArea">
								<label class="input-tips" for="p">密码：</label>
								<div class="inputOuter" id="pArea">
									<input type="password" id="p" name="password"
										class="inputstyle" />
								</div>
							</div>
							<div style="padding-left: 70px; margin-top: 20px;">
								<input type="button" onclick="login()" value="登 录"
									style="width: 150px;" class="button_blue" />
								<!-- 	<a
									style="top: 10px; right: -10px; position: relative"
									href="javascript:findPassword()">忘记密码</a> -->
							</div>
						</form>
					</div>

				</div>

			</div>
			<!--登录end-->
		</div>
	</div>
	<div class="jianyi">*推荐使用edge或firefox浏览器访问本站</div>
</body>
<script type="text/javascript">
	function login() {
		$.ajax({
			type : "post",
			url : "${pageContext.request.contextPath}/loginByMobile",//这里改你的接口
			data : $("#login_form").serialize(),
			dataType : 'text',
			success : function(result) {
				var parsedJson = jQuery.parseJSON(result);
				var flag = parsedJson.status;
				if (flag == 200)
					window.location.href = "${pageContext.request.contextPath}/";
				else
					alert(parsedJson.message);
			}

		})
	}
	function findPassword() {
		var username = prompt("请输入您的账号:");
		if (username != null && username.length != 11) {
			alert("账号格式不正确");
		} else {
			if (username != "" && username != null) {
				var phone = prompt("请输入您注册账号时绑定的手机号码:");
				var phoneTemple = /^1([38]\d|4[57]|5[0-35-9]|7[06-8]|8[89])\d{8}$/;
				if (!phoneTemple.test(phone)) {
					alert("请输入正确的手机号");
				} else {
					$.ajax({
						type : "post",
						url : "${pageContext.request.contextPath}/findPassword",//这里改你的接口
						data : "username=" + username + "&phone=" + phone,
						dataType : 'text',
						success : function(result) {
							var parsedJson = jQuery.parseJSON(result);
							alert(parsedJson.message); //输出信息				
						}

					})
				}
			}
		}
	}
</script>
</html>